<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<rapid:override name="">
	<style>
/*覆盖 layui*/
.layui-input-block {
	margin: 0px 10px;
}

.layui-table {
	margin-top: 0;
}

.layui-col-md4 {
	padding: 10px;
}

.layui-col-md8 {
	padding: 10px;
}

.layui-btn {
	margin: 2px 0 !important;
}
</style>
</rapid:override>
<rapid:override name="frame-content">
	<div style="padding: 15px;">
		<blockquote class="layui-elem-quote">
			<span class="layui-breadcrumb" lay-separator="/"> <a
				href="user/index">首页</a> <a href="link">链接列表</a> <a><cite>
						<c:if test="${flag!='flag' }">
					添加链接
					</c:if> <c:if test="${flag=='flag' }">
					编辑链接
					</c:if>
				</cite></a>
			</span>
		</blockquote>
		<div class="layui-row">
			<c:if test="${flag!='edit' }">
				<div class="layui-col-md4">
					<form class="layui-form" method="post" id="myForm"
						action="link/add">
						<div class="layui-form-item">
							<div class="layui-input-block">
								<strong>编辑链接</strong>
							</div>
							<input type="hidden" name="linkId" value="">
							<div class="layui-input-block">
								名称 <span style="color: #FF5722;">*</span> <input type="text"
									name="linkName" value="" autocomplete="off" class="layui-input"
									required>
							</div>
							<br>
							<div class="layui-input-block">
								URL <span style="color: #FF5722;">*</span> <input type="text"
									name="linkUrl" value="" autocomplete="off" class="layui-input"
									required>
							</div>
							<br>
							<div class="layui-input-block">
								联系方式 <input type="text" name="linkOwnerContact" value=""
									autocomplete="off" class="layui-input">
							</div>
							<br>
							<div class="layui-input-block">
								描述 <input type="text" name="linkDescription" value=""
									autocomplete="off" class="layui-input">
							</div>

							<br>
							<div class="layui-input-block">
								Order <input type="number" name="linkOrder" value=""
									autocomplete="off" class="layui-input" min="0" max="10">
							</div>
							<br>
							<div class="layui-input-block">
								<button class="layui-btn" lay-filter="formDemo" type="submit">添加</button>
							</div>
						</div>
					</form>
					<blockquote class="layui-elem-quote layui-quote-nm">
						温馨提示：
						<ul>
							<li>URL：如 http://liuyanzhao.com</li>
							<li>Order：默认是0，Order越大排名越靠前</li>
						</ul>
					</blockquote>
				</div>
			</c:if>
			<c:if test="${flag=='edit' }">
				<div class="layui-col-md4">
					<form class="layui-form" method="post" id="myForm"
						action="link/edit">
						<div class="layui-form-item">
							<div class="layui-input-block">
								<strong>编辑链接</strong>
							</div>
							<input type="hidden" name="linkId" value="${linkId }">
							<div class="layui-input-block">
								名称 <span style="color: #FF5722;">*</span> <input type="text"
									name="linkName" value="${link.linkName }" autocomplete="off" class="layui-input"
									required>
							</div>
							<br>
							<div class="layui-input-block">
								URL <span style="color: #FF5722;">*</span> <input type="text"
									name="linkUrl" value="${link.linkUrl }" autocomplete="off" class="layui-input"
									required>
							</div>
							<br>
							<div class="layui-input-block">
								联系方式 <input type="text" name="linkOwnerContact" value="${link.linkOwnerContact }"
									autocomplete="off" class="layui-input">
							</div>
							<br>
							<div class="layui-input-block">
								描述 <input type="text" name="linkDescription" value="${link.linkDescription }"
									autocomplete="off" class="layui-input">
							</div>

							<br>
							<div class="layui-input-block">
								Order <input type="number" name="linkOrder" value="${link.linkOrder }"
									autocomplete="off" class="layui-input" min="0" max="10">
							</div>
							<br>
							<div class="layui-input-block">
								<button class="layui-btn" lay-filter="formDemo" type="submit">保存</button>
							</div>
						</div>
					</form>
					<blockquote class="layui-elem-quote layui-quote-nm">
						温馨提示：
						<ul>
							<li>URL：如 http://liuyanzhao.com</li>
							<li>Order：默认是0，Order越大排名越靠前</li>
						</ul>
					</blockquote>
				</div>
			</c:if>

			<div class="layui-col-md8">
				<table class="layui-table">
					<colgroup>
						<col width="50">
						<col width="300">
						<col width="100">
						<col width="50">
						<col width="100">
					</colgroup>
					<thead>
						<tr>
							<th>id</th>
							<th>名称</th>
							<th>URL</th>
							<th>Order</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="link" items="${linkList }">
							<tr>
								<td>${link.linkId }</td>
								<td>${link.linkName }</td>
								<td><a href="http://liuyanzhao.com" target="_blank">${link.linkUrl }</a>
								</td>
								<td>${link.linkOrder }</td>
								<td><a href="link/edit/${link.linkId }"
									class="layui-btn layui-btn-mini">编辑</a> <a
									href="link/delete/${link.linkId }"
									class="layui-btn layui-btn-danger layui-btn-mini"
									onclick="return confirmDelete()">删除</a></td>
							</tr>
						</c:forEach>

					</tbody>
				</table>
			</div>
		</div>
	</div>
</rapid:override>
<%@ include file="../framework.jsp"%>